import request from '@/utils/request'

// 获取所有的Role
export function getAll() {
  return request({
    url: '/ids/roleRest/list',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/ids/roleRest/save',
    method: 'post',
    data
  })
}

export function get(id) {
  return request({
    url: '/ids/roleRest/get/' + id,
    method: 'get'
  })
}

export function getLevel(userId) {
  return request({
    url: '/ids/userRole?userId=' + userId,
    method: 'get'
  })
}

export function del(id) {
  return request({
    url: '/ids/roleRest/delete/' + id,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: '/ids/roleRest/update',
    method: 'put',
    data
  })
}

export function editPermission(data) {
  return request({
    url: '/ids/api/roles/permission',
    method: 'put',
    data
  })
}

export function editMenu(data) {
  return request({
    url: '/ids/roleMenu/save',
    method: 'post',
    data
  })
}

export function listRoleMenusByRoleId(id) {
  return request({
    url: '/ids/roleMenu/listByRoleId' + id,
    method: 'get'
  })
}
